/*
 * ReportServiceImpl.java
 *
 * Created on January 26, 2009, 4:08 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.vacuela.publishmx.services;

import java.util.List;
import java.util.Map;
import org.vacuela.publishmx.context.ServiceContext;
import org.vacuela.publishmx.domains.Message;
import org.vacuela.publishmx.domains.OutputMessage;
import org.vacuela.publishmx.domains.ReportCriteria;

/**
 *
 * @author nestor.carrasco
 */
public class ReportServiceImpl   extends AbstractDaoBasedPublish implements ReportService{
    public void getReportMessages(ServiceContext context) {
        ReportCriteria criteria = (ReportCriteria) context.getAttribute("reportCriteria");
        Map<String, List<Message>> msgMap = (Map<String, List<Message>>)reportDao.getReportMessages(criteria);
        context.setAttribute("msgMap",msgMap);
    }
    
    public void getOutputPhoneNumbers(ServiceContext context) {
        String typeOut = (String)context.getAttribute("typeOut");
        Integer msgId = (Integer)context.getAttribute("msgId");
        OutputMessage outMsg = null;
        
        if ("Agenda".equals(typeOut)){
            outMsg = reportDao.getPhoneNumbersFromAgenda(msgId);
        }else if ("Individual".equals(typeOut)){
            outMsg = reportDao.getPhoneNumbersFromInd(msgId);            
        }        
        context.setAttribute("outMsg", outMsg );
    }
}
